package beans;

import java.util.ArrayList;
import java.util.List;

public class TestsViewBean {
	private List<TestItemBean> testItemsList;
	
	public TestsViewBean() {
		testItemsList = new ArrayList<TestItemBean>();
	}
	
	public void addRow(TestItemBean testItemBean) {
		testItemsList.add(testItemBean);
	}
	
	public String getJson() {
		StringBuffer sb = new StringBuffer();

		sb.append("{ ");
		sb.append("\"row\": [");
		for (int i = 0; i < testItemsList.size(); i++) {
			
			TestItemBean testItemBean = testItemsList.get(i);
			sb.append(testItemBean.getJson());
			
			if (i != testItemsList.size() - 1) {
				sb.append(",");
			}
		}
		sb.append("]");
		sb.append("}");
					
		return sb.toString();
	}
}
